package com.ruoyi.vpn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.vpn.mapper.VpnPlanMapper;
import com.ruoyi.vpn.domain.VpnPlan;
import com.ruoyi.vpn.service.IVpnPlanService;

/**
 * planService业务层处理
 * 
 * @author Edwin
 * @date 2024-01-08
 */
@Service
public class VpnPlanServiceImpl implements IVpnPlanService 
{
    @Autowired
    private VpnPlanMapper vpnPlanMapper;

    /**
     * 查询plan
     * 
     * @param planId plan主键
     * @return plan
     */
    @Override
    public VpnPlan selectVpnPlanByPlanId(Long planId)
    {
        return vpnPlanMapper.selectVpnPlanByPlanId(planId);
    }

    /**
     * 查询plan列表
     * 
     * @param vpnPlan plan
     * @return plan
     */
    @Override
    public List<VpnPlan> selectVpnPlanList(VpnPlan vpnPlan)
    {
        return vpnPlanMapper.selectVpnPlanList(vpnPlan);
    }

    /**
     * 新增plan
     * 
     * @param vpnPlan plan
     * @return 结果
     */
    @Override
    public int insertVpnPlan(VpnPlan vpnPlan)
    {
        vpnPlan.setCreateTime(DateUtils.getNowDate());
        return vpnPlanMapper.insertVpnPlan(vpnPlan);
    }

    /**
     * 修改plan
     * 
     * @param vpnPlan plan
     * @return 结果
     */
    @Override
    public int updateVpnPlan(VpnPlan vpnPlan)
    {
        vpnPlan.setUpdateTime(DateUtils.getNowDate());
        return vpnPlanMapper.updateVpnPlan(vpnPlan);
    }

    /**
     * 批量删除plan
     * 
     * @param planIds 需要删除的plan主键
     * @return 结果
     */
    @Override
    public int deleteVpnPlanByPlanIds(Long[] planIds)
    {
        return vpnPlanMapper.deleteVpnPlanByPlanIds(planIds);
    }

    /**
     * 删除plan信息
     * 
     * @param planId plan主键
     * @return 结果
     */
    @Override
    public int deleteVpnPlanByPlanId(Long planId)
    {
        return vpnPlanMapper.deleteVpnPlanByPlanId(planId);
    }
}
